<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link th:href="@{/css/style.css}" rel="stylesheet" type="text/css" />
  <script type="text/javascript" th:src="@{/js/jquery-1.12.4.js}"></script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>仓库管理</li>
    <li>出库管理</li>
    <li>添加出库</li>
  </ul>
</div>
<form action="/erp/ckWarehouse/addCkWarehouse" method="post" class="formbody" >
  <div class="formtitle"><span>出库信息</span></div>
  <ul class="forminfo">
    <li>
      <label>订单编号</label>
      <select class="dfselect" name="indent">
        <option value="0" >请选择</option>
      </select>
      &nbsp;&nbsp;
      <a id="aaa" href="" title="点击查看客户详细信息" class="tablelink">详情</a>
      <i>必须是审核通过的订单</i>
    </li>
    <script>
      $("select[name=indent]").change(function () {
          var page="/erp/market/order/findByDetails?orderid="+$(this).val();
          $("#aaa").prop("href",page);
      });
    </script>
    <li>
      <label>仓库</label>
      <select class="dfselect" name="warehouseId">
          <option value="0">请选择</option>
      </select>
      <i>必选</i>
    </li>
    <script>
      $(function () {
        $.ajax({
          url:"/erp/market/order/ajaxOrderStatus3",
          dataType:"JSON",
          success:function (data) {
            //console.log(data);
            //console.log(typeof  data);
            var op="<option value='0'>请选择</option>";
            $.each(data,function (i,o) {
              op+="<option value='"+o.orderid+"'>"+o.orderid+"</option>";
            });
            $("select[name=indent]").html("");
            $("select[name=indent]").append(op);
          },error:function () {
            console.log("错误");
          }
        });
        $("select[name=indent]").change(function () {
          if($(this).val()!=null || $(this).val()!=0){
            checkWarehouse($(this).val());
          }
        });
      });
      function checkWarehouse(orderid) {
        $.ajax({
          url:"/erp/market/order/ajaxWarehouseAll",
          data:{"orderid":orderid},
          dataType:"JSON",
          success:function (data) {
            //console.log(data);
            //console.log(typeof  data);
            var op="<option value='0'>请选择</option>";
            $.each(data,function (i,w) {
              op+="<option value='"+w.id+"'>"+w.cname+"</option>";
            });
            $("select[name=warehouseId]").html("");
            $("select[name=warehouseId]").append(op);
          },error:function () {
            console.log("错误");
          }
        });
      }
    </script>
<!--    <li>
      <label>出库时间</label>
      <input name="date" type="date" class="dfinput" />
      <i>必填</i>
    </li>
    <li>
      <label>出库人</label>
      <input name="" type="text" th:value="${session.users.uname}" readonly="readonly" class="roinput" />
      <input name="userId" type="hidden" th:value="${session.users.uId}" readonly="readonly" class="roinput" />
      <i>不能编辑</i>
    <li>-->
      <label>&nbsp;</label>
      <input name="" type="submit" class="btn" value="确定"/>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input name="" type="button" class="btn" value="返回" onclick="window.location.href='/erp/ckWarehouse/lists'"/>
    </li>
  </ul>
</form>
</body>
</html>
